package com.wans.order.feign.fallback;

import com.wans.order.feign.ProductFeignClient;
import com.wans.product.bean.Product;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component
public class ProductFeignFallback implements ProductFeignClient {

    /**
     * 兜底处理
     * @param id 商品id
     * @return 商品信息
     */
    @Override
    public Product getProduct(Long id) {

        Product product = new Product();
        product.setId(id);
        product.setPrice(new BigDecimal(-1));
        product.setProductName("未知商品");
        product.setNum(-1L);

        System.out.println("兜底数据");
        return product;
    }
}
